
<?php
    $url = new Url();
    $arr_region = LoadConfig::$region;

    //var_dump($arr_region);
?>

<script type="text/javascript">

    loadBoxSearch();

    $(document).ready(function(){

        $('#dientoan').addClass('active');
        $('#ketqua').addClass('active');

        loadChat("<?=$url->createUrl('home/chat')?>");

        $(".boxCalendar").datepicker({
            dateFormat: 'yy-mm-dd',
            showOn: 'both',
            buttonImage: ' <?php echo Yii::app()->params['static_url'];?>/images/xo-so-10h-icon-LMT.png',
            buttonImageOnly: true,
        });

        $('.From').keypress(function(e){
            if(e.keyCode == 13 && !e.shiftKey){
                $(this).trigger("enterKey");
            } 
        });

        $('textarea').bind("enterKey",function(e){
            var messenger = $('.From').val();
            var url = "<?=$url->createUrl('home/chat'); ?>";
            $.ajax({
                type: "GET",
                url: url,
                global: false,
                data: {
                    messenger: messenger,
                },
                success: function(msg){  
                    if(msg==1){
                        alert('Bạn phải đăng nhập để tán gẫu');
                    }
                    if(msg==0){
                        alert('Bạn phải chưa nhập nội dung');
                    }
                    else
                    {
                        $("#CHAT").html(msg);
                        $('.From').val('');
                    }

                }
            });
        });

    });

    function loadChat(url){
        var scroll = $('.boxCHAT').scrollTop();
        //alert(scroll);
        $.ajax({
            type: "POST",
            url: url,
            global: false,
            data:{

            },
            success:function(msg){
                $("#CHAT").html(msg);
            }
        });
    }

    function messenger(){
        var messenger = $('.From').val();
        var url = "<?=$url->createUrl('home/chat'); ?>";
        $.ajax({
            type: "GET",
            url: url,
            global: false,
            data: {
                messenger: messenger,
            },
            success: function(msg){
                if(msg==1){
                    alert('Bạn phải đăng nhập để tán gẫu');
                }
                if(msg==0){
                    alert('Bạn phải chưa nhập nội dung');
                }
                else
                {
                    $("#CHAT").html(msg);
                    $('.From').val('');
                } 
            }
        });
    };

    function loadBoxSearch(){
        var url = "<?=$url->createUrl('home/boxsearch');?>";
        $.ajax({
            type: "POST",
            url: url,
            global: false,
            data:{},
            success: function(msg){
                $("#boxsearch").html(msg);
            }
        });
    }

</script>


<div class="leftMain">
    <div class="menuXS">
        <ul>
            <li id="mienbac"><a href="<?php echo Yii::app()->createUrl('ketqua/mienbac')?>">XỔ SỐ MIỀN BẮC</a></li>
            <li id="mientrung"><a href="<?php echo Yii::app()->createUrl('ketqua/mientrung')?>">XỔ SỐ MIỀN TRUNG</a></li>
            <li id="miennam"><a href="<?php echo Yii::app()->createUrl('ketqua/miennam')?>">XỔ SỐ MIỀN NAM</a></li>
            <li id="dientoan"><a href="<?php echo Yii::app()->createUrl('ketqua/dientoan')?>"><h1>XỔ SỐ ĐIỆN TOÁN</h1></a></li>
        </ul>
    </div>


    <div class="Calendar">
        <div>
            <div>
                <form method="POST" action="<?php echo Yii::app()->createUrl('ketqua/redirectDienToan');?>">
                    <a href="javascript:void(0);">
                        <input type="text" name="date" class="boxCalendar" value="<?php echo $data1['ngay_quay']; ?>" style="text-align: center;">
                        <input type="submit" value="Tìm kiếm" class="button_KQ">
                    </a>
                </form>
            </div>
        </div>
        <div class="arrowCalendar_1">
            <a href="<?php echo Yii::app()->createUrl('ketqua/ketquadientoan',array('last'=>date("Y-m-d",strtotime("-1 day",strtotime($data1['ngay_quay'])))));?>"><img src="<?php echo Yii::app()->params['static_url'];?>images/xo-so-10h-icon-arrowlich.png" style="padding-top:14px;"/></a>
        </div>
        <div class="arrowCalendar_2">
            <a href="<?php echo Yii::app()->createUrl('ketqua/ketquadientoan',array('next'=>date("Y-m-d",strtotime("+1 day",strtotime($data1['ngay_quay'])))));?>"><img src="<?php echo Yii::app()->params['static_url'];?>images/xo-so-10h-icon-arrowlich2.png" style="padding-top:14px;"/></a>
        </div>
    </div>

    <div class="SM">
        <table width="100%" border="0" cellspacing="0" cellpadding="0">
            <tr class="bg_cam">
                <td class="SM_1"><p>Kết quả xổ số điện toán ngày <span class="red"><?php echo date('d/m/Y',strtotime($data1['ngay_quay'])); ?></span></p></td>
            </tr>
        </table>

        <table width="100%" border="0" cellspacing="1" cellpadding="0" bgcolor="#e6e6e6">
            <tr class="bg_xam">
                <td class="SM_2"><b>Kết quả xổ số điện toán 123</b></td>
            </tr>
            <tr class="bg_white">
                <td class="SM_2">
                    <center>
                        <span class="boxLetters_1"><?php echo $data1['ketqua_1'];?></span>
                        <span class="boxLetters_1"><?php echo $data1['ketqua_2'];?></span>
                        <span class="boxLetters_1"><?php echo $data1['ketqua_3'];?></span>
                    </center>
                </td>
            </tr>
            <tr class="bg_xam">
                <td class="SM_2"><b>Kết quả xổ số điện toán thần tài</b></td>
            </tr>
            <tr class="bg_white">
                <td class="SM_2">
                    <center>
                        <span class="boxLetters_1"><?php echo $data2['ketqua'];?></span>
                    </center>
                </td>
            </tr>

            <?php if(!empty($data3)){?>
                <tr class="bg_xam">
                    <td class="SM_2"><b>Kết quả xổ số điện toán 6x26 ngày <?php echo date('d/m/Y',strtotime($data1['ngay_quay']));?></b></td>
                </tr>
                <tr class="bg_white">
                    <td class="SM_2">
                        <center>
                            <span class="boxLetters_1"><?php echo $data3['ketqua_1'];?></span>
                            <span class="boxLetters_1"><?php echo $data3['ketqua_2'];?></span>
                            <span class="boxLetters_1"><?php echo $data3['ketqua_3'];?></span>
                            <span class="boxLetters_1"><?php echo $data3['ketqua_4'];?></span>
                            <span class="boxLetters_1"><?php echo $data3['ketqua_5'];?></span>
                            <span class="boxLetters_1"><?php echo $data3['ketqua_6'];?></span>
                        </center>
                    </td>
                </tr>
                <?php }?>

        </table>

    </div>

    <div class="LOTO">
        <div class="sms_LOTO">
            <?php echo Yii::app()->params['static_sms'];?>
        </div>
    </div>
    <div class="MXH">
        <div id="fb-root" style="float: right;"></div>
        <script>(function(d, s, id) {
            var js, fjs = d.getElementsByTagName(s)[0];
            if (d.getElementById(id)) return;
            js = d.createElement(s); js.id = id;
            js.src = "//connect.facebook.net/en_US/sdk.js#xfbml=1&appId=670383849682676&version=v2.0";
            fjs.parentNode.insertBefore(js, fjs);
            }(document, 'script', 'facebook-jssdk'));
        </script>
        <div class="fb-like" data-href="http://10h.vn/" data-layout="standard" data-action="like" data-show-faces="false" data-share="true"></div>
    </div>

    <div class="CHAT">
            
        <div class="titleCHAT">
            Tán Gẫu
        </div>
        
        <div class="CHATarea">
            <textarea name="CHAT" placeholder="Nhập nội dung chat" cols="50" rows="1" class="From"></textarea>
        </div>
        <div style="padding:15px 20px 20px 0; text-align:right;">
            <a href="javascript:void(0);" id="emotion"><img src="<?php echo Yii::app()->params['static_url'];?>images/xo-so-10h-icon-yahoo.png" width="22" height="22" style="padding-right:10px;"></a>
            <a href="javascript:void(0);" onclick="loadChat('<?=$url->createUrl('home/chat')?>');"><img src="<?php echo Yii::app()->params['static_url'];?>images/Refresh.png" width="22" height="22" style="padding-right:10px;" /></a>
            <input type="button" onclick="messenger();" class="button_KQ" value="Gửi">
        </div>

        <div class="boxCHAT" id="CHAT"></div>
        
        <?php $this->renderPartial('boxemotion');?>
        
    </div>

</div>
<div class="rightMain">

    <div class="Box" id="boxsearch"></div>

    <div class="Box" id="boxtienich">
        <?php $this->renderPartial('boxtienich');?>
    </div>

    <div class="Box" id="boxthongke">
        <?php $this->renderPartial('boxthongke');?>
    </div>

</div>
        <div class="both"></div>
